package com.zero2oneblog.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonBackReference;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonManagedReference;
import io.swagger.annotations.ApiModel;

import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import java.io.Serializable;

/**
 * <p>
 * 
 * </p>
 *
 * @author liangjiu
 * @since 2024-01-09
 */
@TableName("test_comment")
@ApiModel(value = "Comment对象", description = "")
public class Comment implements Serializable {

    private static final long serialVersionUID = 1L;

    private Integer id;

    private String content;

    public Integer getPost_id() {
        return post_id;
    }

    public void setPost_id(Integer post_id) {
        this.post_id = post_id;
    }

    private Integer post_id;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    @Override
    public String toString() {
        return "Comment{" +
            "id = " + id +
            ", content = " + content +
        "}";
    }

//    @ManyToOne
//    @JoinColumn(name = "user_id")
//    @JsonManagedReference
//    @ManyToOne
//    @JoinColumn(name = "user_id")
//    @JsonManagedReference
//    private User user;
//
////    @JsonIgnore
//
//    public User getUser() {
//        return user;
//    }
//
////    @JsonIgnore
//    public void setUser(User user) {
//        this.user = user;
//    }

//    @ManyToOne
//    @JoinColumn(name = "post_id")
//    @JsonBackReference
    private Post post;

//    @JsonIgnore
    @ManyToOne
    @JoinColumn(name = "post_id")
    @JsonBackReference
    public Post getPost() {
        return post;
    }

//    @JsonIgnore
    public void setPost(Post post) {
        this.post = post;
    }
}
